import re


class MyTest:
    def clean_en_text(self, text):
        # keep English, digital and space
        comp = re.compile('[^A-Z^a-z^0-9^ ]')
        return comp.sub('', text)

    # make Chinese text clean
    def clean_zh_text(self, text):
        # keep English, digital and Chinese
        comp = re.compile('[^A-Z^a-z^0-9^\u4e00-\u9fa5]')
        return comp.sub('', text)


if __name__ == '__main__':
    mt = MyTest()
    # mt.clean_en_text
    # mt.clean_zh_text

    text_en = '$How old are you? Could you give me your pen?'
    text_zh = '$你好！我是个程序猿，标注码农￥'

    print(mt.clean_en_text(text_en))
    print(mt.clean_zh_text(text_zh))
